import Cookies from 'js-cookie'

const TokenKey = 'Admin-Token'

export function getToken(): string | undefined {
  const token = Cookies.get(TokenKey)
  return token
}

export function setToken(token: string, remember: boolean = false) {
  const options = remember ? { expires: 7 } : undefined
  return Cookies.set(TokenKey, token, options)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}
